#include<bits/stdc++.h>
using namespace std;
struct lll{
	int a;
	double b;
}ans[10005];
bool cmp(lll a,lll b){
	return (a.b/double(a.a))>(b.b/double(b.a));
}

int main()
{
	int n,m;
	double num=0;
	cin>>n>>m;
	for(int i=0;i<n;i++)
		cin>>ans[i].a;
	for(int i=0;i<n;i++)
		cin>>ans[i].b;	
	sort(ans,ans+n,cmp);
	for(int i=0;i<n;i++){
		//if(m==0) break;
		//cout<<ans[i].b<<" 12  "<<ans[i].a<<endl;
		if(ans[i].a<=m){
			num+=ans[i].b;
			m-=ans[i].a;
			//cout<<ans[i].b<<" 12  "<<ans[i].a<<endl;
		}
		else{
			num+=(double(ans[i].b/double(ans[i].a))*double(m));
			m=0;
		}
		//cout<<num<<endl;
		if(m==0) break;
		
	}
	//cout<<ans[1].a<<" "<<ans[1].b;
	printf("%.2f",num);
	return 0;
}
